<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

use Illuminate\Support\Facades\Route;

//乘客端路由
Route::group(['prefix' => 'api/v2/passenger'], function () {


    /*登录相关*/
    Route::group(['prefix' => 'login', 'namespace' => 'Passenger\V2'], function () {

        Route::get('refund', 'LoginController@testRefund'); //测试数据退款 todo 上线删除
        Route::get('cheshi', 'LoginController@cheshi'); //充值退款 todo 上线删除

        Route::post('account', 'LoginController@accountLogin'); //账号登录
        Route::post('wxmin', 'LoginController@wxminLogin'); //微信小程序登录
        Route::post('phone', 'LoginController@PhoneLogin'); //手机号登录

    });
    /**广告图**/
    Route::group(['prefix' => 'index', 'namespace' => 'Passenger\V2\Index'], function () {

        Route::post('banner', 'IndexController@banner'); //广告列表
    });

    /*用户相关*/
    Route::group(['prefix' => 'user', 'namespace' => 'Passenger\V2\User', 'middleware' => 'auth:api'], function () {

        Route::post('init', 'UserController@setInit'); //初始化
        Route::post('authwxmini', 'UserController@authWxmini'); //微信小程序授权
        Route::post('setunionid', 'UserController@setUnionid'); //设置用户Unionid
        Route::post('detail', 'UserController@detail'); //获取信息
        Route::post('edit', 'UserController@edit'); //修改信息
        Route::post('setpassword', 'UserController@setPassword'); //修改密码

        Route::get('getcouponlist', 'UserController@getCouponList'); //我的优惠券列表
        Route::post('drawcoupon', 'UserController@drawCoupon'); //领取优惠券列表
        Route::post('drawcoupons', 'UserController@drawCoupons'); //领取优惠券列表

        Route::post('recharge', 'RechargeController@userRecharge'); //用户充值
        Route::post('refund_order', 'RechargeController@refund_order'); //余额支付
        Route::post('wallet', 'RechargeController@wallet'); //钱包


    });


    /*订单相关*/
    Route::group(['prefix' => 'order', 'namespace' => 'Passenger\V2\Order'], function () {

        Route::group(['middleware' => 'auth:api'], function () {

            //费用
            Route::post('cost/predict', 'CostController@getPredict'); //获取预计费用
            //获取代驾预估费
            Route::post('cost/driving_predict', 'CostController@driving_predict'); //获取预计费用


            //订单
            Route::post('pending', 'OrderController@pending'); //
            Route::get('getlist', 'OrderController@getList'); //我的订单列表
            Route::get('detail', 'OrderController@detail'); //我的订单详情
            Route::post('create', 'OrderController@create'); //下单
            Route::post('cancel', 'OrderController@cancel'); //取消
            Route::post('setcancelreason', 'OrderController@setCancelReason'); //设置取消理由
            Route::post('confirm', 'OrderController@confirm'); //确认订单 仅处理不需补款/退款的订单
            Route::get('getcouponlist', 'OrderController@getCouponList'); //获取当前订单可使用的优惠券列表


            //支付
            Route::post('pay/create', 'PayController@create'); //创建支付信息
            Route::post('pay/createsuccess', 'PayController@createSuccess'); //创建支付信息

            //退款
            Route::post('refund/index', 'RefundController@index'); //退款

            //评论
            Route::post('comment/create', 'CommentController@create'); //添加评论
        });

        //回调
        Route::post('notify/hsk394mhl', 'PayNotifyController@wxminiPredict');// 微信支付
        Route::post('notify/ujh953owm', 'RefundNotifyController@weixin');// 微信退款

    });
});
